package commands;

import utils.Clock;
import utils.Utils;
import controllers.MetronomeController;

public class IncMeasureCommand implements ICommand
{
	private MetronomeController metronomeController;
	
	/**
	 * Constructeur
	 * @param metronomeController : Le controller
	 */
	public IncMeasureCommand(MetronomeController metronomeController)
	{
		this.metronomeController = metronomeController;
	}
	
	@Override
	public void execute() 
	{
		int currentMeasure = this.metronomeController.getMetronome().getMeasure();
		if(currentMeasure < Utils.MEASURE_MAX)
		{
			this.metronomeController.updateMeasure(currentMeasure+1);
			Clock.StartBattreTempo(new TempoLedCommand(this.metronomeController), new MeasureLedCommand(this.metronomeController), 
					this.metronomeController.getMetronome().getTempo(), this.metronomeController.getMetronome().getMeasure());
		}
	}
}
